﻿using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;

using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;

namespace CompassTestApp
{
    public partial class Program
    {
        GTM.Seeed.Compass compass = new GTM.Seeed.Compass(4);

        void ProgramStarted()
        {
            /******************************************************************************************
            Access modules defined in the designer by typing their name:                            
            
            e.g.  button
                  camera1

            Initialize event handlers here.
            e.g. button.ButtonPressed += new GTM.MSR.Button.ButtonEventHandler(button_ButtonPressed);             
            ***************************************************************************************** */            
            compass.MeasurementComplete += new GTM.Seeed.Compass.MeasurementCompleteEventHandler(compass_MeasurementComplete);
            compass.StartContinuousMeasurements();

            // Do one-time tasks here
            Debug.Print("Program Started");
        }

        void compass_MeasurementComplete(GTM.Seeed.Compass sender, GTM.Seeed.Compass.SensorData sensorData)
        {
            Debug.Print(sensorData.ToString());
        }
    }
}
